#pragma once

#ifdef ASSERTTHREAD_EXPORTS
#define ASSERTTHREAD_API __declspec(dllexport)
#else
#define ASSERTTHREAD_API __declspec(dllimport)
#endif

namespace AssertThread
{

enum ThreadType
{
	UIThread,
	Threadpool,		// TppWorkerThread
	OrderedTask,	// Must be Threadpool
	ThreadTypeMax
};

ASSERTTHREAD_API void SetInThread(ThreadType type, bool bSet);
ASSERTTHREAD_API bool IsInThread(ThreadType type);

}	// namespace AssertThread

#define AssertInUIThread()		assert(AssertThread::IsInThread(AssertThread::UIThread))
#define AssertInThreadpool()	assert(AssertThread::IsInThread(AssertThread::Threadpool))
#define AssertInOrderedTask()	assert(AssertThread::IsInThread(AssertThread::OrderedTask))

#ifdef _DEBUG
#define SetInUIThread(bSet)		AssertThread::SetInThread(AssertThread::UIThread, bSet)
#define SetInOrderedTask(bSet)	AssertThread::SetInThread(AssertThread::OrderedTask, bSet)
#else
#define SetInUIThread(bSet)		((void)0)
#define SetInOrderedTask(bSet)	((void)0)
#endif
